package com.example.inventory.data

import androidx.room.*
import kotlinx.coroutines.flow.Flow

@Dao
interface ItemDao {
    @Insert(onConflict = OnConflictStrategy.IGNORE)
    fun insert(item: Item)

    @Delete
    fun delete(item: Item)

    @Update
    fun update(item: Item)

    @Query("SELECT * from item ORDER BY name ASC")
    abstract fun getItems(): Flow<List<Item>>

    @Query("SELECT * from item where id = :id")
    abstract fun getItem(id: Int): Flow<Item>
}